using System;
using Deepcode.Flux.Core.Codons;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Extensions.Codons;
using Deepcode.Flux.Core.Systems.UI.Menus;

namespace Deepcode.Flux.Core.Codons.Menus
{
	/// <summary>
	/// <MenuGroup 
	///		id="menuSecurity" 
	///		title="Security Management">
	/// 
	/// Codon to represent a menu group
	/// 
	/// </summary>
	[XmlCodonName("MenuGroup")]
	public class MenuGroupCodon : AbstractCodon
	{
		[XmlCodonAttribute("title")]
		private string title = "";

		public override object BuildItem(object owner, System.Collections.ArrayList subItems)
		{
			// Only return an object if we have items...
			if( subItems.Count < 1 ) return null;

			MenuGroup group = new MenuGroup( title, ID, subItems );
			return group;
		}
	}
}
